<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    * {
        margin: 0;
    }

    .aa {
        /*position: absolute;*/
        margin: 100px;
        width: 100px;
        height: 100px;
        background-color: red;
        /*position: relative;*/
        position: fixed;
        right: 20px;
        top: 300px;
    }

    .bb {
        position: relative;
        left: 20px;
        top: 20px;
        width: 50px;
        height: 50px;
        background-color: blue;
    }
    .cc{
        height: 1000px;
    }
</style>
<body>
<div class="cc"></div>
<div class="aa">
    <div class="bb"></div>
</div>
</body>
</html>